#ifndef __COMPOSITE_H__
#define __COMPOSITE_H__
#include <iostream>
#include <string>
#include <memory>
#include <list>

class FileSystem{
public:
    FileSystem(std::string name):m_name(name){
    }
    virtual ~FileSystem() = default;
    virtual void showName(int level) = 0;
    virtual void Add(std::shared_ptr<FileSystem> component) = 0;
    virtual void Remove(std::shared_ptr<FileSystem> component) = 0;
protected:
    std::string m_name;

};

class File : public FileSystem{
public:
    File(std::string name):FileSystem(name){}
    ~File()=default;
    virtual void showName(int level);
    virtual void Add(std::shared_ptr<FileSystem> component){
        return;
    }
    virtual void Remove(std::shared_ptr<FileSystem> component){
        return;
    }

};

class Dir : public FileSystem{
public:
    Dir(std::string name):FileSystem(name){}
    ~Dir()=default;
    virtual void showName(int level);
    virtual void Add(std::shared_ptr<FileSystem> component);
    virtual void Remove(std::shared_ptr<FileSystem> component);

private:
    std::list<std::shared_ptr<FileSystem>> m_fileList;

};



#endif